//package com.registration.Aspect;
//
//
//import cn.dev33.satoken.stp.StpUtil;
//import com.registration.util.JsonResponse;
//import jakarta.servlet.http.HttpServletRequest;
//import org.aspectj.lang.ProceedingJoinPoint;
//import org.aspectj.lang.annotation.Around;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.annotation.Pointcut;
//import org.mybatis.logging.LoggerFactory;
//import org.springframework.core.annotation.Order;
//import org.springframework.stereotype.Component;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//
//
//@Aspect
//@Component
//@Order(1)
//public class LoginCheckAspect {
//    /**
//     * 定义切入点：拦截除登录接口外的所有Controller方法
//     */
//    @Pointcut("execution(* com.registration.controller..*(..)) " +
//            "&& !execution(* com.registration.controller.PCUserController..*(..))"+
//            "&& !execution(* com.registration.controller.UserController..*(..))")
//
//    public void requireLoginPointcut() {}
//
//    @Around("requireLoginPointcut()")
//    public Object checkLogin(ProceedingJoinPoint joinPoint) throws Throwable {
//
//
//        JsonResponse response ;
//       /* System.out.println("======= LoginCheckAspect 被触发 =======");
//        System.out.println("当前登录状态: " + StpUtil.isLogin());
//        System.out.println("loginId: " + StpUtil.getLoginIdDefaultNull());
//        System.out.println("loginType: " + StpUtil.getLoginType());*/
//
//       try{
//           // 检查是否已登录
//           if (!StpUtil.isLogin()) {
//               // 未登录，返回未登录提示
//               response = JsonResponse.loginOut();
//               return response;
//           }
//           // 已登录，继续执行原方法
//           return joinPoint.proceed();
//       }catch (Throwable throwable) {
//           // 抛出异常
//           throw throwable;
//       }
//    }
//}
//
